package com.zdkj.subway.st.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdkj.common.security.util.ObjectUtils;
import com.zdkj.subway.st.dto.in.SwTkTemporaryDistributionPlanNoticeDTO;
import com.zdkj.subway.st.entity.SwTkTemporaryDistributionPlanNotice;
import com.zdkj.subway.st.mapper.SwTkTemporaryDistributionPlanNoticeMapper;
import com.zdkj.subway.st.service.SwTkTemporaryDistributionPlanNoticeService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 线网临时配收计划通知
 *
 * @author cuilei
 * @date 2020-06-16 11:29:28
 */
@Service
public class SwTkTemporaryDistributionPlanNoticeServiceImpl extends ServiceImpl<SwTkTemporaryDistributionPlanNoticeMapper, SwTkTemporaryDistributionPlanNotice> implements SwTkTemporaryDistributionPlanNoticeService {

    @Override
    public Boolean saveBathByNotice(List<SwTkTemporaryDistributionPlanNoticeDTO> swTkTemporaryDistributionPlanNotices) {
        List<SwTkTemporaryDistributionPlanNotice> saveList = new ArrayList<>();
        swTkTemporaryDistributionPlanNotices.forEach(item -> {
            SwTkTemporaryDistributionPlanNotice defaultObj = ObjectUtils.getDefaultObj(SwTkTemporaryDistributionPlanNotice.class);
            BeanUtils.copyProperties(item, defaultObj);
            saveList.add(defaultObj);
        });
        return saveBatch(saveList);
    }
}
